```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring定时任务与调度详解</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            line-height: 1.8;
            color: #333;
        }
        .hero {
            background: linear-gradient(135deg, #6e8efb, #a777e3);
        }
        .code-block {
            background-color: #2d3748;
            color: #f7fafc;
            border-left: 4px solid #a777e3;
        }
        .card {
            transition: all 0.3s ease;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
        }
        .section-title {
            position: relative;
            padding-left: 1.5rem;
        }
        .section-title:before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            height: 100%;
            width: 5px;
            background: linear-gradient(to bottom, #6e8efb, #a777e3);
        }
        .dropcap:first-letter {
            float: left;
            font-size: 3.5em;
            line-height: 0.8;
            padding-right: 8px;
            color: #6e8efb;
            font-weight: 700;
        }
    </style>
</head>
<body class="bg-gray-50">
    <!-- Hero Section -->
    <section class="hero text-white py-20 px-4 md:px-10 lg:px-20">
        <div class="max-w-5xl mx-auto">
            <div class="flex items-center mb-4">
                <i class="fas fa-clock text-3xl mr-3"></i>
                <h1 class="text-4xl md:text-5xl font-bold font-serif">Spring定时任务与调度</h1>
            </div>
            <p class="text-xl md:text-2xl opacity-90 max-w-3xl leading-relaxed">
                Spring提供的强大定时任务调度功能，让开发者能够轻松配置和管理复杂的定时任务执行流程。从简单的@Scheduled注解到Quartz集成，Spring为各类定时任务场景提供了完善的解决方案。
            </p>
        </div>
    </section>

    <!-- Main Content -->
    <main class="max-w-5xl mx-auto px-4 md:px-10 lg:px-20 py-12">
        <!-- Overview Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 section-title">1. Spring 定时任务与调度的概述</h2>
            <div class="grid md:grid-cols-2 gap-8">
                <div class="bg-white p-6 rounded-lg card">
                    <div class="flex items-center mb-4">
                        <i class="fas fa-list-check text-blue-500 text-2xl mr-3"></i>
                        <h3 class="text-xl font-semibold">定时任务类型</h3>
                    </div>
                    <p class="text-gray-700 dropcap">Spring提供了多种定时任务实现方式，包括基于注解的方式（如@Scheduled）、编程方式（如使用TaskScheduler）、以及更复杂的调度任务（如Quartz集成）。这些方式为开发者提供了灵活的定时任务配置选择，可以满足不同复杂度的业务需求。</p>
                </div>
                <div class="bg-white p-6 rounded-lg card">
                    <div class="flex items-center mb-4">
                        <i class="fas fa-cogs text-purple-500 text-2xl mr-3"></i>
                        <h3 class="text-xl font-semibold">核心优势</h3>
                    </div>
                    <ul class="list-disc pl-5 text-gray-700 space-y-2">
                        <li>简化定时任务的配置和管理</li>
                        <li>支持多种调度策略（固定速率、固定延迟、Cron表达式）</li>
                        <li>提供线程池支持，实现多任务并行执行</li>
                        <li>无缝集成Quartz等高级调度框架</li>
                    </ul>
                </div>
            </div>
        </section>

        <!-- Core Components Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 section-title">2. Spring 定时任务的核心组件</h2>
            <div class="bg-white p-6 rounded-lg card mb-8">
                <div class="flex items-center mb-4">
                    <i class="fas fa-microchip text-blue-500 text-2xl mr-3"></i>
                    <h3 class="text-xl font-semibold">TaskScheduler 接口</h3>
                </div>
                <p class="text-gray-700 mb-4">TaskScheduler接口定义了调度任务的方法，包括通过触发器（Trigger）进行调度、固定速率调度、固定延迟调度等。这些方法都是基于线程池来实现任务的异步调度。</p>
                <div class="code-block p-4 rounded-lg mb-4 overflow-x-auto">
                    <pre class="text-sm"><code>public interface TaskScheduler {
    ScheduledFuture<?> schedule(Runnable task, Trigger trigger);
    ScheduledFuture<?> scheduleAtFixedRate(Runnable task, long period);
    ScheduledFuture<?> scheduleWithFixedDelay(Runnable task, long delay);
}</code></pre>
                </div>
            </div>
            
            <div class="bg-white p-6 rounded-lg card">
                <div class="flex items-center mb-4">
                    <i class="fas fa-server text-purple-500 text-2xl mr-3"></i>
                    <h3 class="text-xl font-semibold">ThreadPoolTaskScheduler 实现类</h3>
                </div>
                <p class="text-gray-700 mb-4">ThreadPoolTaskScheduler是Spring提供的默认TaskScheduler实现，采用线程池方式调度任务，支持高效的定时任务执行。schedule方法会接受任务和触发器，基于触发器调度任务。</p>
                <div class="code-block p-4 rounded-lg overflow-x-auto">
                    <pre class="text-sm"><code>public class ThreadPoolTaskScheduler extends ExecutorConfigurationSupport 
    implements TaskScheduler, InitializingBean {
    private int poolSize = 10;

    @Override
    public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {
        return getScheduledExecutor().schedule(new RunnableScheduledFuture(task, trigger));
    }
}</code></pre>
                </div>
            </div>
        </section>

        <!-- @Scheduled Annotation Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 section-title">3. 使用 @Scheduled 注解实现定时任务</h2>
            <div class="bg-white p-6 rounded-lg card mb-8">
                <div class="flex items-center mb-4">
                    <i class="fas fa-tag text-blue-500 text-2xl mr-3"></i>
                    <h3 class="text-xl font-semibold">@Scheduled 注解的源码解析</h3>
                </div>
                <p class="text-gray-700 mb-4">@Scheduled注解提供了三种配置方式：cron（通过Cron表达式）、fixedDelay（指定任务执行后的延迟时间）和fixedRate（指定任务的执行频率）。</p>
                <div class="code-block p-4 rounded-lg mb-4 overflow-x-auto">
                    <pre class="text-sm"><code>@Target(value=TYPE)
@Retention(value=RUNTIME)
@EnableAspectJAutoProxy(proxyTargetClass=false)
@Import(value=ScheduledAnnotationBeanPostProcessor.class)
public @interface Scheduled {
    String cron() default "";
    long fixedDelay() default -1;
    long fixedRate() default -1;
}</code></pre>
                </div>
            </div>
            
            <div class="bg-white p-6 rounded-lg card">
                <div class="flex items-center mb-4">
                    <i class="fas fa-code text-purple-500 text-2xl mr-3"></i>
                    <h3 class="text-xl font-semibold">@Scheduled 注解的使用示例</h3>
                </div>
                <p class="text-gray-700 mb-4">下面是一个使用@Scheduled注解定义定时任务的简单示例，该任务会每隔1秒钟执行一次。</p>
                <div class="code-block p-4 rounded-lg overflow-x-auto">
                    <pre class="text-sm"><code>@Component
public class MyTask {
    @Scheduled(fixedRate = 1000)
    public void task() {
        System.out.println("Executing task at: " + LocalTime.now());
    }
}</code></pre>
                </div>
            </div>
        </section>

        <!-- Cron Expression Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 section-title">5. 使用 Cron 表达式进行复杂调度</h2>
            <div class="bg-white p-6 rounded-lg card mb-8">
                <div class="flex items-center mb-4">
                    <i class="fas fa-calendar-alt text-blue-500 text-2xl mr-3"></i>
                    <h3 class="text-xl font-semibold">Cron 表达式的格式</h3>
                </div>
                <div class="grid md:grid-cols-2 gap-6">
                    <div>
                        <p class="text-gray-700 mb-4">Cron表达式为开发者提供了灵活的调度方式，可以精确指定分钟、小时、日期等。</p>
                        <div class="code-block p-4 rounded-lg overflow-x-auto">
                            <pre class="text-sm"><code>*    *    *    *    *    *
┬    ┬    ┬    ┬    ┬    ┬
│    │    │    │    │    │
│    │    │    │    │    └─ Day of week (0-7)
│    │    │    │    └───── Month (1-12)
│    │    │    └────────── Day of month (1-31)
│    │    └─────────────── Hour (0-23)
│    └──────────────────── Minute (0-59)
└───────────────────────── Second (0-59)</code></pre>
                        </div>
                    </div>
                    <div>
                        <p class="text-gray-700 mb-4">基于Cron表达式的定时任务示例，该任务会每5分钟执行一次。</p>
                        <div class="code-block p-4 rounded-lg overflow-x-auto">
                            <pre class="text-sm"><code>@Scheduled(cron = "0 0/5 * * * ?")
public void cronTask() {
    System.out.println("This task runs every 5 minutes");
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- Diagram Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 section-title">Spring定时任务架构流程图</h2>
            <div class="bg-white p-6 rounded-lg card">
                <div class="mermaid">
                    graph TD
                    A[开发者定义@Scheduled方法] --> B[ScheduledAnnotationBeanPostProcessor]
                    B --> C[注册任务到TaskScheduler]
                    C --> D[ThreadPoolTaskScheduler]
                    D --> E[执行定时任务]
                    E -->|异常处理| F[ErrorHandler]
                    E -->|日志记录| G[Logger]
                    F --> E
                    style A fill:#f0f9ff,stroke:#bae6fd
                    style B fill:#f0fdf4,stroke:#bbf7d0
                    style C fill:#fffbeb,stroke:#fde68a
                    style D fill:#f5f3ff,stroke:#ddd6fe
                    style E fill:#ecfdf5,stroke:#a7f3d0
                </div>
            </div>
        </section>

        <!-- Quick Reference Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-6 section-title">快速参考指南</h2>
            <div class="grid md:grid-cols-3 gap-6">
                <div class="bg-white p-6 rounded-lg card">
                    <div class="flex items-center mb-4">
                        <i class="fas fa-clock text-blue-500 text-2xl mr-3"></i>
                        <h3 class="text-xl font-semibold">固定速率调度</h3>
                    </div>
                    <p class="text-gray-700">固定速率调度，无论前一个任务是否完成，都会按照固定时间间隔执行。</p>
                    <div class="code-block p-4 rounded-lg mt-4 overflow-x-auto">
                        <pre class="text-sm"><code>@Scheduled(fixedRate = 5000)</code></pre>
                    </div>
                </div>
                <div class="bg-white p-6 rounded-lg card">
                    <div class="flex items-center mb-4">
                        <i class="fas fa-hourglass-half text-purple-500 text-2xl mr-3"></i>
                        <h3 class="text-xl font-semibold">固定延迟调度</h3>
                    </div>
                    <p class="text-gray-700">固定延迟调度，在前一个任务完成后，延迟指定时间再执行下一个任务。</p>
                    <div class="code-block p-4 rounded-lg mt-4 overflow-x-auto">
                        <pre class="text-sm"><code>@Scheduled(fixedDelay = 5000)</code></pre>
                    </div>
                </div>
                <div class="bg-white p-6 rounded-lg card">
                    <div class="flex items-center mb-4">
                        <i class="fas fa-calendar text-blue-500 text-2xl mr-3"></i>
                        <h3 class="text-xl font-semibold">Cron表达式</h3>
                    </div>
                    <p class="text-gray-700">使用Cron表达式实现复杂调度逻辑。</p>
                    <div class="code-block p-4 rounded-lg mt-4 overflow-x-auto">
                        <pre class="text-sm"><code>@Scheduled(cron = "0 0 9 * * ?")</code></pre>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-10 px-4">
        <div class="max-w-5xl mx-auto flex flex-col md:flex-row justify-between items-center">
            <div class="mb-4 md:mb-0">
                <h3 class="text-xl font-bold text-white mb-1">技术小馆</h3>
                <p class="text-sm">专注于高质量技术内容分享</p>
            </div>
            <div>
                <a href="http://www.yuque.com/jtostring" class="text-blue-300 hover:text-white transition-colors duration-200">
                    <i class="fas fa-globe mr-2"></i>技术小馆地址: http://www.yuque.com/jtostring
                </a>
            </div>
        </div>
    </footer>

    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```